import 'dart:io';

import 'package:curved_navigation_bar/curved_navigation_bar.dart';
import 'package:flutter/material.dart';
import '../pages/searching_card.dart';
import '../pages/directory_page.dart';
import '../pages/user_card.dart';

import 'package:my_app/example/animated_button.dart';

class BottomNavigatorBarDemo extends StatefulWidget {
  final List<Widget> bottomWidgets = [SearchingCard(), DirectoryCard(), GeneralUserPage()];
  @override
  _BottomNavigatorBarDemoState createState() => _BottomNavigatorBarDemoState();
}

class _BottomNavigatorBarDemoState extends State<BottomNavigatorBarDemo> {
  int _index = 0;
  GlobalKey<CurvedNavigationBarState> _bottomNavigationKey = GlobalKey();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      bottomNavigationBar: CurvedNavigationBar(
          key: _bottomNavigationKey,
          index: 0,
          height: 60.0,
        items: [
          Icon(Icons.home,size:30,),
          Icon(Icons.article,size:30,),
          Icon(Icons.account_circle,size:30,),
        ],
            color: Colors.blueGrey,
            buttonBackgroundColor: Colors.blueGrey,
        backgroundColor: Colors.white,
        animationCurve: Curves.easeInOut,
        animationDuration: Duration(milliseconds: 600),
        onTap: (index) {
          setState(() {
            _index = index;
          });
        },
        letIndexChange: (index) => true,

      ),

      body: widget.bottomWidgets[_index],
    );
  }
}
